package com.heima.article.controller;

import com.heima.article.service.AuthorService;
import com.heima.model.common.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/author")
public class AuthorController {

    @Autowired
    AuthorService authorService;
    @GetMapping("/findByUserId/{id}")
    ResponseResult findByUserId(@PathVariable Integer id){
        return ResponseResult.okResult(authorService.getById(id));


    }
    @PostMapping("/save")
    ResponseResult save(@RequestBody ApAuthor apAuthor){
        authorService.save(apAuthor);
        return ResponseResult.okResult();

    }

}
